<?php

namespace app\admin\model\shop\notify;

use app\admin\library\Auth;
use think\Model;

/**
 * Notify
 */
class Notify extends Model
{
    // 表名
    protected $name = 'shop_notify';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;

    protected $type = [
        'message_data' => 'json'
    ];

    public function getStatusAttr($value): int
    {
        $adminId = Auth::instance()->id;

        return in_array($adminId, explode(',', self::getAttr('reader_id'))) ? 1 : 0;
    }
}